﻿using System;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;

namespace Vosc.VirtualOscilloscope
{
	// Token: 0x02000005 RID: 5
	public partial class BitMaskForm : Form
	{
		// Token: 0x17000009 RID: 9
		// (get) Token: 0x0600002E RID: 46 RVA: 0x000048C3 File Offset: 0x00002AC3
		public ushort BitMask
		{
			get
			{
				return this.bitMask;
			}
		}

		// Token: 0x0600002F RID: 47 RVA: 0x000048CB File Offset: 0x00002ACB
		public BitMaskForm() : this(ushort.MaxValue)
		{
		}

		// Token: 0x06000030 RID: 48 RVA: 0x000048D8 File Offset: 0x00002AD8
		public BitMaskForm(ushort bitMask)
		{
			this.InitializeComponent();
			this.bitMask = bitMask;
			base.Load += this.BitMaskForm_Load;
		}

		// Token: 0x06000031 RID: 49 RVA: 0x00004900 File Offset: 0x00002B00
		private void BitMaskForm_Load(object sender, EventArgs e)
		{
			for (int i = 0; i < 16; i++)
			{
				bool @checked = (this.bitMask >> i & 1) == 1;
				((CheckBox)base.Controls.Find("checkBox" + i.ToString(), true)[0]).Checked = @checked;
			}
		}

		// Token: 0x06000032 RID: 50 RVA: 0x00004955 File Offset: 0x00002B55
		private void buttonCancel_Click(object sender, EventArgs e)
		{
			base.DialogResult = DialogResult.Cancel;
		}

		// Token: 0x06000033 RID: 51 RVA: 0x00004960 File Offset: 0x00002B60
		private void buttonOk_Click(object sender, EventArgs e)
		{
			ushort num = 0;
			for (int i = 0; i < 16; i++)
			{
				bool @checked = ((CheckBox)base.Controls.Find("checkBox" + i.ToString(), true)[0]).Checked;
				ushort num2 = 0;
				if (@checked)
				{
					num2 = (ushort)(1 << i);
				}
				num |= num2;
			}
			this.bitMask = num;
			base.DialogResult = DialogResult.OK;
		}

		// Token: 0x06000034 RID: 52 RVA: 0x000049C6 File Offset: 0x00002BC6
		private void btn_SelectAll_Click(object sender, EventArgs e)
		{
			this.setCheckBoxStatus(true);
		}

		// Token: 0x06000035 RID: 53 RVA: 0x000049CF File Offset: 0x00002BCF
		private void btn_UnselectAll_Click(object sender, EventArgs e)
		{
			this.setCheckBoxStatus(false);
		}

		// Token: 0x06000036 RID: 54 RVA: 0x000049D8 File Offset: 0x00002BD8
		private void setCheckBoxStatus(bool isSelect)
		{
			this.checkBox0.Checked = isSelect;
			this.checkBox1.Checked = isSelect;
			this.checkBox2.Checked = isSelect;
			this.checkBox3.Checked = isSelect;
			this.checkBox4.Checked = isSelect;
			this.checkBox5.Checked = isSelect;
			this.checkBox6.Checked = isSelect;
			this.checkBox7.Checked = isSelect;
			this.checkBox8.Checked = isSelect;
			this.checkBox9.Checked = isSelect;
			this.checkBox10.Checked = isSelect;
			this.checkBox11.Checked = isSelect;
			this.checkBox12.Checked = isSelect;
			this.checkBox13.Checked = isSelect;
			this.checkBox14.Checked = isSelect;
			this.checkBox15.Checked = isSelect;
		}

		// Token: 0x04000042 RID: 66
		private ushort bitMask;
	}
}
